home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 236_01 / cb.doc < prev    next >
Text File  |  1989-06-05  |  2KB  |  93 lines

  1. /*
  2.     HEADER:        CUG236;
  3.     TITLE:        C Source Formatter Manual Page;
  4.     DATE:        04/04/1987;
  5.     VERSION:    2.1;
  6.     FILENAME:    CB.DOC;
  7.     SEE-ALSO:    CB.C;
  8.     AUTHORS:    W. C. Colley III, J. W. Kindschi Jr.;
  9. */
  10.  
  11.          "C" Source Formatter   'Pretty Printer'
  12.  
  13.  
  14. DESCRIPTION:
  15.  
  16.      This program takes as input a "C" source  program    file  and 
  17.  
  18.      formats  it with the proper indents for each statement.  The 
  19.  
  20.      formatted     output      is placed in a specified  file,  or  by 
  21.  
  22.      default, to the standard output.
  23.  
  24. INVOCATION:
  25.  
  26.      CB inputfile { outputfile }
  27.  
  28.      inputfile        Input  "C" source program.     This file should 
  29.             be    a file that has compiled error    free,  as 
  30.             the formatter is not smart enough to pick  up 
  31.             syntax errors.
  32.  
  33.      outputfile        This  is the formatted output file.      If this
  34.             argument  is  omitted,  the formatted  output
  35.             goes to the standard output stream.
  36.  
  37. HELP:
  38.  
  39.      Typing CB with no file name displays a short help reminder.
  40.  
  41. EXAMPLE:
  42.  
  43.      Run CB on file test, send the output to stdout:
  44.  
  45.       CB TEST
  46.  
  47.  
  48. *** <Contents of TEST before run.> ***
  49.  
  50. #include "stdio.h"
  51. double ran()
  52. /*        Generate a random number between 0.0 and 1.0    */
  53. {
  54. double r;
  55. static unsigned int seed = 0;
  56. struct regval { 
  57. int ax,bx,cx,dx,si,di,ds,es; 
  58. };
  59. struct regval regs;
  60.  
  61. if (seed==0) {
  62. regs.ax = 0x2C00;        /* Set up the function */
  63. sysint(0x21,®s,®s);
  64. seed = regs.dx;
  65. }
  66. r = seed / 65536.;
  67. seed = (25173 * seed + 13849) % 65536; 
  68. return(r);
  69. }
  70.  
  71.  
  72. *** <As seen on stdout after the run.> ***
  73.  
  74. #include "stdio.h"
  75. double ran()
  76. /*        Generate a random number between 0.0 and 1.0    */
  77. {
  78.     double r;
  79.     static unsigned int seed = 0;
  80.     struct regval { 
  81.         int ax,bx,cx,dx,si,di,ds,es; 
  82.     };
  83.     struct regval regs;
  84.  
  85.     if (seed==0) {
  86.         regs.ax = 0x2C00;         /* Set up the function */
  87.         sysint(0x21,®s,®s);
  88.         seed = regs.dx;
  89.     }
  90.     r = seed / 65536.;
  91.     seed = (25173 * seed + 13849) % 65536;
  92. }
  93.